{$CLEO}
jump @_Main                                                                                                                           
:_return
return

{$INCLUDE include\Keyboard.txt}

// UI System constants
const
    SpinnerSizeX            =   8.0
    SpinnerSizeY            =   15.0

    MouseSizeX              =   12.0
    MouseSizeY              =   12.0
    MouseSizeXm             =   6.0
    MouseSizeYm             =   6.0
        
    SpinnerTx               =   10
    MouseTx                 =   11
    
    GXTKey_Decimal          = 'BIRDDF'
    GXTKey_Integer          = 'BIRDDI'
end
{$INCLUDE include\UI_System.txt}


// Variables
const
    timera = 32@
    timerb = 33@
    timer_click = timera
    click_delay = 300

    // 0@ ~ 5@ = Pseudo-registers

    bShouldHandleCameraMovement = 6@
    PanelSelectionHandler = 7@
    Status          = 8@
    hPanel1         = 9@ 
    pMethodTable    = 10@    
    MouseX          = 11@
    MouseY          = 12@
    pBirdType       = 13@
    pCBird          = 14@
    Index           = 15@    

    DistCamInEdit = 16@
    CamAngle1 = 17@
    CamAngle2 = 18@
    MinDistInCamEdit = 1.0
    MaxDistInCamEdit = 50.0
    
    bTestingBird            = 19@

    Box_Array               = 21@    
    Box_MinSpawnTime        = 21@
    Box_MaxSpawnTime        = 22@
    Box_MinBirdsInFlock     = 23@
    Box_MaxBirdsInFlock     = 24@
    Box_MinBirdHeight       = 25@
    Box_MaxBirdHeight       = 26@
    Box_MinBirdSize         = 27@
    Box_MaxBirdSize         = 28@
    Box_BirdDistance        = 29@
    Box_BirdSpeed           = 30@
    Box_WingSpeed           = 31@

    STATUS_EXIT_TOOL    = -1
    STATUS_IDLE         = 0
    STATUS_CREATE_BIRD  = 1
    STATUS_EDIT_BIRD    = 2

    STATUS_EDIT_BIRD_TYPE_MODE_IDLE = 101
    STATUS_EDIT_BIRD_TYPE_MODE_VALUES = 102
    
    STATUS_EDITING_FLAGS = 111
    STATUS_EDITING_TOWN = 112

    XEditBirdPos = 1951.0
    YEditBirdPos = -1295.2084
    ZEditBirdPos = 90.6518
    
    XCamInEditS = 1951.0  
    YCamInEditS = -1275.5425
    ZCamInEditS = 96.447
    
    XPointToInEdit = XEditBirdPos
    YPointToInEdit = YEditBirdPos
    ZPointToInEdit = ZEditBirdPos
       
    randSpeed = 16
    
	BIRD_SPAWN_NEAR_WATER			= 1
	BIRD_GLIDABLE					= 2
	BIRD_HEIGHT_RELATIVE_TO_CAMERA	= 4
	BIRD_HEIGHT_RELATIVE_TO_GROUND	= 8
	
	SIZE_BIRD_POOL   = 6
end

// GXT keys
const
    t_BirdDevTool               = 'BIRDD01'
    t_Credits                   = 'BIRDD02'
    
    t_PanelTitle                = 'BIRDD03'
    t_CreateNewBType            = 'BIRDD04'
    t_EditExistingBType         = 'BIRDD05'
    t_HideMenu                  = 'BIRDD06'
    t_Exit                      = 'BIRDD07'
    t_ReloadTextures            = 'BIRDD08'
    t_SaveChanges               = 'BIRDD09'
    t_DiscardChanges            = 'BIRDD10'
    
    t_PleaseSelectTheBirdName   = 'BIRDD20'
    t_TypeToOpenMenu            = 'BIRDD21'
    t_TypeToExit                = 'BIRDD22'
    t_ValuesAreMinMax           = 'BIRDD23'
    t_CouldNotSaveChanges       = 'BIRDD24'
    t_CouldSaveChanges          = 'BIRDD25'
    t_TexturesReloaded          = 'BIRDD26'
    t_SelectValidBirdName       = 'BIRDD27'
    t_HelpEditMode              = 'BIRDD28'
    t_HelpEditValuesMode        = 'BIRDD29'        
    
    t_EditBirdName              = 'BIRDD30'
    t_EditSpawningTown          = 'BIRDD31'
    t_EditValues                = 'BIRDD32'
    t_EditFlags                 = 'BIRDD33'

    t_Countryside               = 'BIRDD34'
    t_LosSantos                 = 'BIRDD35'
    t_SanFierro                 = 'BIRDD36'
    t_LasVenturas               = 'BIRDD37'
    t_Desert                    = 'BIRDD38'

    t_SpawnTime                 = 'BIRDD39'
    t_BirdsInFlock              = 'BIRDD40'
    t_BirdHeight                = 'BIRDD41'
    t_BirdSize                  = 'BIRDD42'
    t_BirdDistance              = 'BIRDD43'
    t_BirdSpeed                 = 'BIRDD44'
    t_WingSpeed                 = 'BIRDD45'
    
    t_Flag1                     = 'BIRDD51'
    t_Flag2                     = 'BIRDD52'
    t_Flag3                     = 'BIRDD53'
    t_Flag4                     = 'BIRDD54'
    NUMBER_OF_BIRD_FLAGS        = 4
    
    t_FlagError_CameraGround    = 'BIRDD70'

    PANEL_FLAG_DESTROY                  = -2
    PANEL_FLAG_PRESSED_OTHER            = -1
    PANEL_FLAG_PRESSED_SELECT           = 0    
    PANEL_FLAG_PRESSED_EXIT             = 1
    PANEL_FLAG_PRESSED_SPINNER_UP       = 2
    PANEL_FLAG_PRESSED_SPINNER_DOWN     = 3
    
        
end

:Initialize
{ Get CBirds Method Table }
    pMethodTable = 0x0
    if 8AA2: not 0@ = load_library "TheBirdsUpdate.asi" // Increase ref counter
    then
        0ACA: show_text_box "Failed to load 'TheBirdsUpdate.asi'"
    else
        if 8AA4: not 1@ = get_proc_address "GetCBirdsMethodTable" library 0@
        then
            0ACA: show_text_box "Failed to get 'GetCBirdsMethodTable' address"        
        else
            0AA7: call_function 1@ num_params 0 pop 0 store_to pMethodTable
        end
        0AA3: free_library 0@   // Decrease ref counter
    end
    
    if pMethodTable == 0x0
    then
        059A: return_false
        return
    end

{ Get Textures }
    0390: load_txd_dictionary 'BIRDD'
    038F: load_texture "MOUSE" as MouseTx
    038F: load_texture "SPINNER" as SpinnerTx
    
0485: return_true
return

:Cleanup
0391: release_textures
return


:_Main
{-------------------- SCRIPT MAIN LOOP --------------------}
while true
    wait 100
    if  0ADC:   test_cheat "BIRDD"
    then
        if gosub @Initialize
        then
            gosub @DevMode
            gosub @Cleanup
        end      
    end
end


{-------------------- DEV MODE MAIN LOOP --------------------}
:DevMode
gosub @DiscardChanges   // If there's changes in queue to be discarded, discard it
gosub @SaveStatus
0826: enable_hud 0
0581: enable_radar 0
Status = STATUS_IDLE
hPanel1 = -1
PanelSelectionHandler = 0

gosub @CreateMainPanel

while true
    wait 0
    if or
        Status == STATUS_EXIT_TOOL
        8256:   not player $PLAYER_CHAR defined
    then
        break
    end
    
    if Status == STATUS_IDLE
    then    
        if hPanel1 == -1
        then
            if  0ADC:   test_cheat "BIRDD"
            then
                gosub @CreateMainPanel
            end
        end
    else
        01B4: set_player $PLAYER_CHAR can_move 0

        if and
            Status >= 100
            Status <= 199
        then
            // Editing bird
            gosub @ProcessEditMode
        end
    end
    
    gosub @ProcessPanel
    gosub @DrawGraphics
        
end

0826: enable_hud 1
0581: enable_radar 1
gosub @DiscardChanges
return

:SaveStatus
0085: 0@ = pMethodTable
0@ += 96    // [24] - SaveChanges 
0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0
0AA5: call 0@ num_params 0 pop 0
return

{-------------------- EDIT MODE LOOP --------------------}
:ProcessEditMode
if 0485: return_true    // !!!! FIXME !!!!
then
    if and
        Index <> -1
        pCBird == 0
    then
        gosub @EditMode_CreateDebugBird     
    end
    
    if Index == -1
    then
        gosub @DestroyPanel
        gosub @Edit_SelectABird
        if Index == -1
        then
            00BC: show_text_highpriority GXT t_SelectValidBirdName time 3000 flag 0
            jump @ExitEditMode
        end
        return
    end

    if 0AB1: call_scm_func @Mouse_UsedWheelDown 0
    then        
        if 0AB0:   key_pressed 0x11 // CTRL
        then
            DistCamInEdit += 0.3
        else
            DistCamInEdit += 0.7            
        end
        if DistCamInEdit > MaxDistInCamEdit
        then
           DistCamInEdit = MaxDistInCamEdit
        end
        gosub @SetEditCameraPosition            
    else
        if 0AB1: call_scm_func @Mouse_UsedWheelUp 0
        then
            if 0AB0:   key_pressed 0x11 // CTRL
            then
                DistCamInEdit -= 0.3
            else
                DistCamInEdit -= 0.7            
            end
            if DistCamInEdit < MinDistInCamEdit
            then
                DistCamInEdit = MinDistInCamEdit
            end
            gosub @SetEditCameraPosition
        end    
    end
        
    if Status <> STATUS_EDIT_BIRD_TYPE_MODE_VALUES
    then
        if hPanel1 == -1
        then
            if 0ADC:   test_cheat "BIRDD"
            then
                if Index <> -1
                then
                    jump @CreateEditPanel
                end
            end
        end
    else
        gosub @ProcessEditValuesBoxes 
    end
    
    if 0AB1: call_scm_func @Mouse_IsPressing_LMB 0     
    then
        if bShouldHandleCameraMovement == true
        then
            0A4A: store_joystick_X_offset_to 0@ Y_offset_to 1@
            if 0A4C:   mouse_not_inverted_vertically
            then
                1@ *= -1.0
            end
            0A8D: 2@ = read_memory 0xB6EC1C size 4 virtual_protect 0
            006B: 0@ *= 2@
            006B: 1@ *= 2@
            0@ *= 230.0
            1@ *= 230.0

            005B: CamAngle1 += 0@

            005B: CamAngle2 += 1@
            if or
                CamAngle2 > 90.0
                CamAngle2 < -90.0
            then
                0063: CamAngle2 -= 1@
            end
            jump @SetEditCameraPosition
        else
            bShouldHandleCameraMovement = true            
        end                
    end
                
end
return

:Edit_SelectABird
00BC: show_text_highpriority GXT t_PleaseSelectTheBirdName time 10000 flag 0
0AC6: 0@ = label @_TextBuffer offset
if 0AB1: call_scm_func @SHOW_KEYBOARD 2 pointer 0@ max_chars 15
then
    0085: 1@ = pMethodTable
    1@ += 88    // [22] - BirdIndexByName
    0A8D: 1@ = read_memory 1@ size 4 virtual_protect 0
    0AA7: call_function 1@ num_params 1 pop 1 0@ store_to Index
end
return


:InitEditMode
// Destroy all birds
0085: 0@ = pMethodTable
0@ += 56 // [14]
0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0
0AA5: call 0@ num_params 0 pop 0

pCBird = 0
pBirdType = 0

CamAngle1 = 0.0
CamAngle2 = 0.0

01EB: set_traffic_density_multiplier_to 0.0
03DE: set_pedestrians_density_multiplier_to 0.0

016A: fade 0 time 1000
wait 1000
03CB: set_rendering_origin_at XEditBirdPos YEditBirdPos ZEditBirdPos
DistCamInEdit = 5.0
gosub @SetEditCameraPosition
wait 1000
016A: fade 1 time 1000

Status = STATUS_EDIT_BIRD_TYPE_MODE_IDLE

// Disable menu
//0A8C: write_memory 0xB5F852 size 1 value true virtual_protect 0
return

:ExitEditMode
:UnInitEditMode
01EB: set_traffic_density_multiplier_to 1.0
03DE: set_pedestrians_density_multiplier_to 1.0
02EB: restore_camera_with_jumpcut
Status = STATUS_IDLE

Index = -1
pCBird = 0
pBirdType = 0

// Enable menu
//0A8C: write_memory 0xB5F852 size 1 value false virtual_protect 0

// Destroy all birds
0085: 0@ = pMethodTable
0@ += 56 // [14]
0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0
0AA5: call 0@ num_params 0 pop 0
return



:SetEditCameraPosition
// Set camera position
{ Camera XY }
0656: get_angle CamAngle1 absolute_degrees_to 0@
02F6: 1@ = sine 0@
006B: 1@ *= DistCamInEdit
1@ += XEditBirdPos
0087: 2@ = 1@ 
02F7: 1@ = cosine 0@
006B: 1@ *= DistCamInEdit
1@ += YEditBirdPos
0087: 3@ = 1@ 

{ Camera Z }
0656: get_angle CamAngle2 absolute_degrees_to 0@
02F6: 1@ = sine 0@
02F7: 0@ = cosine 0@
0037: 1@ /= 0@
006B: 1@ *= DistCamInEdit
0087: 4@ = 1@
4@ += ZEditBirdPos

015F: set_camera_position 2@ 3@ 4@ rotation 0.0 0.0 0.0
0160: set_camera_point_at XPointToInEdit YPointToInEdit ZPointToInEdit mode 2
return



:EditMode_CreateDebugBird
gosub @GetBirdTypePtr
0085: 0@ = pMethodTable
0@ += 60 // [15]
0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0
{CBird* __cdecl CBirds::CreateDebugBird(float x, float y, float z, int type, const char* typeIdentifier, int randSpeed)}
0AA7: call_function 0@ num_params 6 pop 6 randSpeed 0x0 Index ZEditBirdPos YEditBirdPos XEditBirdPos     store_to pCBird
return


{-------------------- DRAWING --------------------}

:DrawGraphics
03F0: enable_text_draw 1

{ Draw Bird Dev Tool Text }
gosub @SetupTextDraw
033E: set_draw_text_position 10.0 10.0 GXT t_BirdDevTool
gosub @SetupTextDraw
033E: set_draw_text_position 15.0 23.0 GXT t_Credits

{ Draw Help Text }
if or
    Status == STATUS_IDLE
    Status == STATUS_EDIT_BIRD_TYPE_MODE_IDLE
then
    if hPanel1 == -1
    then
        gosub @SetupTextDraw
        0340: set_text_draw_RGBA 0 204 153 255
        033E: set_draw_text_position 13.0 400.0 GXT t_TypeToOpenMenu    
    end
end

if and
    Status == STATUS_EDIT_BIRD_TYPE_MODE_IDLE
    hPanel1 <> -1
then
    gosub @SetupTextDraw
    0340: set_text_draw_RGBA 0 204 153 255
    033E: set_draw_text_position 150.0 10.0 GXT t_HelpEditMode
end

if Status == STATUS_EDIT_BIRD_TYPE_MODE_VALUES
then
    // Should draw the text boxes
    gosub @DrawEditValueBoxes

    // Should also draw the mouse
    0AB1: call_scm_func @Mouse_Update 2 MouseX MouseY return MouseX MouseY
    038D: draw_texture MouseTx MouseX MouseY MouseSizeX MouseSizeY RGBA 255 255 255 255

    gosub @SetupTextDraw
    0340: set_text_draw_RGBA 0 204 153 255
    033E: set_draw_text_position 13.0 336.0 GXT t_TypeToExit

    gosub @SetupTextDraw
    0340: set_text_draw_RGBA 0 204 153 255    
    033E: set_draw_text_position 200.0 10.0 GXT t_ValuesAreMinMax   

{    gosub @SetupTextDraw
    0340: set_text_draw_RGBA 0 204 153 255    
    033E: set_draw_text_position 13.0 350.0 GXT t_HelpEditValuesMode 
}   
end
return

:SetupTextDraw
03E0: draw_text_behind_textures 0
033F: set_text_draw_letter_size 0.4 1.5 
0343: set_text_draw_linewidth 640.0 
060D: draw_text_shadow 1 color_RGBA 0 0 0 255 
0340: set_text_draw_RGBA 255 255 255 255 
return 

:SetupTextDraw_TextBoxName
jump @SetupTextDraw

:SetupTextDraw_TextBoxValue
03E0: draw_text_behind_textures 0
033F: set_text_draw_letter_size 0.4 1.5 
0343: set_text_draw_linewidth 640.0 
060D: draw_text_shadow 1 color_RGBA 0 0 0 255 
0340: set_text_draw_RGBA 255 0 0 255
return


{-------------------- PANEL --------------------}
:ProcessPanel
if and
    PanelSelectionHandler <> 0
    timer_click >= click_delay
then
    if 00E1:   player 0 pressed_key 16 // Space
    then
        timer_click = 0
        0@ = PANEL_FLAG_PRESSED_SELECT
        jump PanelSelectionHandler    
    end
    
    if 00E1:   player 0 pressed_key 15 // Enter
    then
        timer_click = 0
        0@ = PANEL_FLAG_PRESSED_EXIT
        jump PanelSelectionHandler    
    end             
end
return

:DestroyPanel
01B4: set_player $PLAYER_CHAR can_move 1
PanelSelectionHandler = 0
if hPanel1 <> -1
then
    08DA: remove_panel hPanel1
    hPanel1 = -1
end
return

:FinalizePanelCreation
090E: set_panel hPanel1 active_row 0
01B4: set_player $PLAYER_CHAR can_move 0
timer_click = 0
return

{-------------------- PANEL CREATORS --------------------}
:CreateMainPanel
PanelSelectionHandler = @MainPanelHandler  
08D4: hPanel1 = create_panel_with_title t_PanelTitle position 400.00 120.00 width 180.0 columns 1 interactive 1 background 1 alignment 0 
08DB: set_panel hPanel1 column 0 header 'DUMMY' data t_CreateNewBType t_EditExistingBType t_ReloadTextures t_SaveChanges t_DiscardChanges t_HideMenu t_Exit 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY'  
jump @FinalizePanelCreation

:CreateEditPanel
PanelSelectionHandler = @EditPanelHandler
08D4: hPanel1 = create_panel_with_title t_PanelTitle position 400.00 120.00 width 180.0 columns 1 interactive 1 background 1 alignment 0 
08DB: set_panel hPanel1 column 0 header 'DUMMY' data t_EditBirdName t_EditSpawningTown t_EditValues t_EditFlags t_ReloadTextures t_HideMenu t_Exit 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY'  
jump @FinalizePanelCreation

:CreateBirdFlagsPanel
PanelSelectionHandler = @FlagPanelHandler
08D4: hPanel1 = create_panel_with_title t_PanelTitle position 400.00 120.00 width 180.0 columns 1 interactive 1 background 1 alignment 0 
08DB: set_panel hPanel1 column 0 header 'DUMMY' data t_Flag1 t_Flag2 t_Flag3 t_Flag4  t_Exit 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY'  
gosub @FinalizePanelCreation
jump @FlagPanelUpdate

:CreateBirdTownPanel
PanelSelectionHandler = @TownPanelHandler
08D4: hPanel1 = create_panel_with_title t_PanelTitle position 400.00 120.00 width 180.0 columns 1 interactive 1 background 1 alignment 0 
08DB: set_panel hPanel1 column 0 header 'DUMMY' data t_Countryside t_LosSantos t_SanFierro t_LasVenturas t_Desert t_Exit 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY'
gosub @FinalizePanelCreation
jump @BirdTownPanelUpdate

:CreateBirdValuesPanel
PanelSelectionHandler = @BirdValuesHandler
jump @InitEditValuesMode


{-------------------- PANEL HANDLERS --------------------}
{-------------------- MAIN PANEL HANDLER --------------------}
:MainPanelHandler
if
    0@ == PANEL_FLAG_PRESSED_SELECT
jf @Click_HideMenu 
08D7: 0@ = panel hPanel1 active_row
0871: init_jump_table 0@ total_jumps 7 default_jump 0 @_return jumps 0 @Click_CreateNewBType 1 @Click_EditExistingBType 2 @Click_ReloadTextures 3 @Click_SaveChanges 4 @Click_DiscardChanges 5 @Click_HideMenu 6 @Click_ExitTool

:Click_CreateNewBType
gosub @DestroyPanel

//
gosub @LoadDefaultBirdTypeIntoBuffer
0085: 0@ = pMethodTable
0@ += 76 // [19]    - AddNewBirdType
0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0
0AC6: 1@ = label @_BirdType offset
0AA7: call_function 0@ num_params 1 pop 1 -> 1@ resultIndex_to Index

gosub @GetBirdTypePtr
gosub @InitEditMode
jump @CreateEditPanel 

:Click_EditExistingBType
gosub @HideMenu
Index = -1
pCBird = 0
pBirdType = 0
gosub @InitEditMode
jump @CreateEditPanel

:SaveChanges
:Click_SaveChanges
// Save Data File
0085: 0@ = pMethodTable
0@ += 92    // [23] - RewriteDataFile
0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0
0AA7: call_function 0@ num_params 0 pop 0 store_result_to 0@
if 88B7:   NOT test 0@ bit 0
then
    00BC: show_text_highpriority GXT t_CouldNotSaveChanges time 5000 flag 0
    return
else
    00BC: show_text_highpriority GXT t_CouldSaveChanges time 5000 flag 0
end
jump @SaveStatus
return

:DiscardChanges
:Click_DiscardChanges
0085: 0@ = pMethodTable
0@ += 100    // [25] - DiscardChanges
0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0
0AA5: call 0@ num_params 0 pop 0
return

:HideMenu
:Click_HideMenu
gosub @DestroyPanel
return

:Click_ExitTool
Status = STATUS_EXIT_TOOL
gosub @DestroyPanel
return

{-------------------- EDIT PANEL HANDLER --------------------}
:EditPanelHandler
if
    0@ == PANEL_FLAG_PRESSED_SELECT
jf @Click_ExitEdit
08D7: 0@ = panel hPanel1 active_row
0871: init_jump_table 0@ total_jumps 7 default_jump 0 @_return jumps 0 @Click_EditBirdName 1 @Click_EditSpawningTown 2 @Click_EditValues 3 @Click_EditFlags 4 @Click_ReloadTextures 5 @Click_HideEditMenu 6 @Click_ExitEdit

:Click_EditBirdName
gosub @DestroyPanel
00BC: show_text_highpriority GXT t_PleaseSelectTheBirdName time 1000000 flag 0
0AC6: 0@ = label @_TextBuffer offset
if 0AB1: call_scm_func @SHOW_KEYBOARD 2 pointer 0@ max_chars 15
then    
    0AA5: call {strncpy} 0x821F40 num_params 3 pop 3 _len 16 _src 0@ _dest pBirdType    
end
00BE: text_clear_all
jump @CreateEditPanel

:Click_EditValues
gosub @DestroyPanel
jump @CreateBirdValuesPanel

:Click_EditSpawningTown
gosub @DestroyPanel
jump @CreateBirdTownPanel

:Click_EditFlags
gosub @DestroyPanel
jump @CreateBirdFlagsPanel

:Click_ReloadTextures
0085: 0@ = pMethodTable
0@ += 84 // [21]
0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0
0AA5: call 0@ num_params 0 pop 0
00BC: show_text_highpriority GXT t_TexturesReloaded time 1000 flag 0
return

:Click_HideEditMenu
jump @DestroyPanel

:Click_ExitEdit
0085: 0@ = pMethodTable
0@ += 52 // [13]    - DestroyBird
0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0
0AA5: call 0@ num_params 1 pop 1 pCBird
gosub @Click_HideEditMenu
gosub @ExitEditMode
return


{-------------------- BIRD TOWN PANEL HANDLER --------------------}
:TownPanelHandler
if
    0@ == PANEL_FLAG_PRESSED_SELECT
jf @TownPanelExit
08D7: 0@ = panel hPanel1 active_row
if 0@ > 4
then
    jump @TownPanelExit
end
005A: 0@ += pBirdType
0@ += 20
0A8D: 1@ = read_memory 0@ size 1 virtual_protect 0
if 1@ == false
then
    0A8C: write_memory 0@ size 1 value true virtual_protect 0
else
    0A8C: write_memory 0@ size 1 value false virtual_protect 0    
end
jump @BirdTownPanelUpdate

:TownPanelExit
gosub @DestroyPanel
gosub @CreateEditPanel
return

:BirdTownPanelUpdate
0085: 0@ = pBirdType
0@ += 20
for 1@ = 0 to 4
    0A8D: 2@ = read_memory 0@ size 1 virtual_protect 0
    0A23: set_panel hPanel1 row 1@ shopping_item_bought 2@
    0@ += 0x1
end
return


{-------------------- FLAGS PANEL HANDLER --------------------}
:FlagPanelHandler
if
    0@ == PANEL_FLAG_PRESSED_SELECT
jf @FlagPanelExit

08D7: 0@ = panel hPanel1 active_row
if 0@ >= NUMBER_OF_BIRD_FLAGS
then
    jump @FlagPanelExit
end

0085: 1@ = pBirdType
1@ += 69 // flags
0A8D: 2@ = read_memory 1@ size 4 virtual_protect 0

if 08B7:   test 2@ bit 0@
then
    08C3: clear 2@ bit 0@
else
    08BD: set 2@ bit 0@
end

0A8C: write_memory 1@ size 4 value 2@ virtual_protect 0
jump @FlagPanelUpdate

:FlagPanelExit
0085: 1@ = pBirdType
1@ += 69 // flags
0A8D: 2@ = read_memory 1@ size 4 virtual_protect 0

// Make some checks before exiting the panel
if and
    08B7:   test 2@ 2 //BIRD_HEIGHT_RELATIVE_TO_CAMERA
    08B7:   test 2@ 3 //BIRD_HEIGHT_RELATIVE_TO_GROUND
then
    // Can't exit
    00BC: show_text_highpriority GXT t_FlagError_CameraGround time 5000 flag 0
    return
end

00BE: text_clear_all
gosub @DestroyPanel
gosub @CreateEditPanel
return


:FlagPanelUpdate
0@ = 0
0085: 1@ = pBirdType
1@ += 69 // flags
0A8D: 1@ = read_memory 1@ size 4 virtual_protect 0
while true
    if 08B7:   test 1@ bit 0@
    then
        0A23: set_panel hPanel1 row 0@ shopping_item_bought true
    else
        0A23: set_panel hPanel1 row 0@ shopping_item_bought false
    end    
    0@ += 1
    if 0@ < NUMBER_OF_BIRD_FLAGS
    jf break
end
return

{-------------------- FLAG VALUES HANDLER --------------------}
:BirdValuesHandler
bShouldHandleCameraMovement = false

if 0@ == PANEL_FLAG_PRESSED_EXIT
then
    gosub @DiscardBirdValues
    jump @ExitEditValuesMode
end

if 0@ == PANEL_FLAG_PRESSED_SELECT
then
    jump @ExitEditValuesMode
end

if 0AB0:   key_pressed 0x11 // CTRL
then
    2@ = 1   // Fast!
else
    if 0AB0:   key_pressed 0x12 // ALT
    then
        2@ = 2  // Very slow
    else
        if  0AB0:   key_pressed 0x10 // SHIFT
        then
            2@ = 3 // Very fast            
        else 
            2@ = 0  // Slow
        end
    end
end


//
0871: init_jump_table 1@ total_jumps 11 default_jump 0 @_return jumps    Box_MinSpawnTime @ValuesHandler_MinSpawnTime Box_MaxSpawnTime @ValuesHandler_MaxSpawnTime   Box_MinBirdsInFlock @ValuesHandler_MinBirdsInFlock Box_MaxBirdsInFlock @ValuesHandler_MaxBirdsInFlock   Box_MinBirdHeight @ValuesHandler_MinBirdHeight Box_MaxBirdHeight @ValuesHandler_MaxBirdHeight  Box_MinBirdSize @ValuesHandler_MinBirdSize
0872: jump_table_jumps Box_MaxBirdSize @ValuesHandler_MaxBirdSize   Box_BirdDistance @ValuesHandler_BirdDistance    Box_BirdSpeed @ValuesHandler_BirdSpeed  Box_WingSpeed @ValuesHandler_WingSpeed 0 -1 0 -1 0 -1 0 -1 0 -1 0

:ValuesHandler_GetSppinerDirection_Int
0085: 1@ = 0@
if 2@ == 1
then
    0@ = 2
else
    if 2@ == 3
    then
        0@ = 10
    else
        0@ = 1
    end
end
if 1@ == PANEL_FLAG_PRESSED_SPINNER_DOWN
then
    0@ *= -1
end
return

:ValuesHandler_GetSppinerDirection_Float
0085: 1@ = 0@
if 2@ == 1
then
    0@ = 0.1
else
    if 2@ == 2
    then
        0@ = 0.001
    else
        if 2@ == 3
        then
            0@ = 5.0
        else
            0@ = 0.01
        end
    end
end
if 1@ == PANEL_FLAG_PRESSED_SPINNER_DOWN
then
    0@ *= -1.0   
end
return




:ValuesHandler_MinSpawnTime
4@ = 25
jump @ValuesHandler_SpawnTime

:ValuesHandler_MaxSpawnTime
4@ = 29
jump @ValuesHandler_SpawnTime

:ValuesHandler_SpawnTime
if timerb < 100
then
    return
end
timerb = 0
gosub @ValuesHandler_GetSppinerDirection_Int
0A8E: 1@ = pBirdType + 4@
0A8D: 3@ = read_memory 1@ size 4 virtual_protect 0
005A: 3@ += 0@
if 3@ > 23
then
    3@ = 0
else
    if 3@ < 0
    then
        3@ = 23
    end
end
0A8C: write_memory 1@ size 4 value 3@ virtual_protect 0
00C0: set_current_time 3@ 0
return




:ValueHandler_BirdsInFlock
if timerb < 100
then
    return
end
timerb = 0
gosub @ValuesHandler_GetSppinerDirection_Int
0A8E: 1@ = pBirdType + 4@
0A8D: 3@ = read_memory 1@ size 4 virtual_protect 0
005A: 3@ += 0@
if 3@ > SIZE_BIRD_POOL
then
    3@ = 0
else
    if 3@ < 0
    then
        3@ = SIZE_BIRD_POOL
    end
end
0A8C: write_memory 1@ size 4 value 3@ virtual_protect 0
return

:ValuesHandler_MinBirdsInFlock
4@ = 33
jump @ValueHandler_BirdsInFlock

:ValuesHandler_MaxBirdsInFlock
4@ = 37
jump @ValueHandler_BirdsInFlock





:ValuesHandler_BirdHeight
if timerb < 100
then
    return
end
timerb = 0
gosub @ValuesHandler_GetSppinerDirection_Float
0A8E: 1@ = pBirdType + 4@
0A8D: 3@ = read_memory 1@ size 4 virtual_protect 0
005B: 3@ += 0@
0A8C: write_memory 1@ size 4 value 3@ virtual_protect 0
return

:ValuesHandler_MinBirdHeight
4@ = 41
jump @ValuesHandler_BirdHeight

:ValuesHandler_MaxBirdHeight
4@ = 45
jump @ValuesHandler_BirdHeight





:ValuesHandler_BirdSize
if timerb < 100
then
    return
end
timerb = 0
gosub @ValuesHandler_GetSppinerDirection_Float
0A8E: 1@ = pBirdType + 4@
0A8D: 3@ = read_memory 1@ size 4 virtual_protect 0
005B: 3@ += 0@
if 3@ < 0.0
then
    3@ = 0.0
end
0A8C: write_memory 1@ size 4 value 3@ virtual_protect 0

// Reload bird size
0085: 0@ = pMethodTable
0@ += 108 // [27]
0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0
0AA5: call 0@ num_params 2 pop 2 3@ pCBird
return


:ValuesHandler_MinBirdSize
4@ = 49
jump @ValuesHandler_BirdSize

:ValuesHandler_MaxBirdSize
4@ = 53
jump @ValuesHandler_BirdSize





:ValuesHandler_BirdDistance
if timerb < 100
then
    return
end
timerb = 0
gosub @ValuesHandler_GetSppinerDirection_Float
0A8E: 1@ = pBirdType + 57
0A8D: 3@ = read_memory 1@ size 4 virtual_protect 0
005B: 3@ += 0@
if 3@ <= 0
then
    3@ = 1
end
0A8C: write_memory 1@ size 4 value 3@ virtual_protect 0
return

:ValuesHandler_BirdSpeed
if timerb < 100
then
    return
end
timerb = 0
gosub @ValuesHandler_GetSppinerDirection_Float
0A8E: 1@ = pBirdType + 61
0A8D: 3@ = read_memory 1@ size 4 virtual_protect 0
005B: 3@ += 0@
0A8C: write_memory 1@ size 4 value 3@ virtual_protect 0

if bTestingBird == true
then
    0085: 0@ = pMethodTable
    0@ += 116 // [29]
    0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0
    0AA5: call 0@ num_params 3 pop 3 randSpeed -1.0 pCBird
end
return

:ValuesHandler_WingSpeed
if timerb < 100
then
    return
end
timerb = 0
0085: 4@ = 0@
gosub @ValuesHandler_GetSppinerDirection_Int
0A8E: 1@ = pBirdType + 65
0A8D: 3@ = read_memory 1@ size 4 virtual_protect 0
005A: 3@ += 0@
if and
    3@ == 0  // Can't be 0, otherwise a division by zero will occur
    3@ > -1
then
    if 4@ == PANEL_FLAG_PRESSED_SPINNER_UP
    then
        3@ = 1
    else
        3@ = -1
    end
end
0A8C: write_memory 1@ size 4 value 3@ virtual_protect 0

// Reload wing speed
0085: 0@ = pMethodTable
0@ += 112 // [28]
0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0
0AA5: call 0@ num_params 3 pop 3  randSpeed 3@ pCBird
return







:InitEditValuesMode
Status = STATUS_EDIT_BIRD_TYPE_MODE_VALUES

{ Put the mouse in the middle of the screen }
MouseX = 320
MouseY = 224

{ Save current bird values }
0AC6: 1@ = label @_BirdType offset
0AA5: call {memmove} 0x822A20 num_params 3 pop 3 _len 77 _src pBirdType _dest 1@

{ }
0085: 0@ = pCBird
0@ += 0x49  // Moveable
0A8C: write_memory 0@ size 1 value false virtual_protect 0
bTestingBird = false


{ Create boxes }
0AC6: 1@ = label @TextboxBuffer offset

0AB1: call_scm_func @textBox__New 5 _ptr 1@ XY 570.0 50.0 Size 100.0 15.0 store_to Box_MinSpawnTime
1@ += sizeof_textBox
0AB1: call_scm_func @textBox__New 5 _ptr 1@ XY 570.0 70.0 Size 100.0 15.0 store_to Box_MaxSpawnTime
1@ += sizeof_textBox

0AB1: call_scm_func @textBox__New 5 _ptr 1@ XY 570.0 110.0 Size 100.0 15.0 store_to Box_MinBirdsInFlock
1@ += sizeof_textBox
0AB1: call_scm_func @textBox__New 5 _ptr 1@ XY 570.0 130.0 Size 100.0 15.0 store_to Box_MaxBirdsInFlock
1@ += sizeof_textBox

0AB1: call_scm_func @textBox__New 5 _ptr 1@ XY 570.0 170.0 Size 100.0 15.0 store_to Box_MinBirdHeight
1@ += sizeof_textBox
0AB1: call_scm_func @textBox__New 5 _ptr 1@ XY 570.0 190.0 Size 100.0 15.0 store_to Box_MaxBirdHeight
1@ += sizeof_textBox

0AB1: call_scm_func @textBox__New 5 _ptr 1@ XY 570.0 230.0 Size 100.0 15.0 store_to Box_MinBirdSize
1@ += sizeof_textBox
0AB1: call_scm_func @textBox__New 5 _ptr 1@ XY 570.0 250.0 Size 100.0 15.0 store_to Box_MaxBirdSize
1@ += sizeof_textBox


0AB1: call_scm_func @textBox__New 5 _ptr 1@ XY 70.0 100.0 Size 100.0 15.0 store_to Box_BirdDistance
1@ += sizeof_textBox
0AB1: call_scm_func @textBox__New 5 _ptr 1@ XY 70.0 140.0 Size 100.0 15.0 store_to Box_BirdSpeed
1@ += sizeof_textBox
0AB1: call_scm_func @textBox__New 5 _ptr 1@ XY 70.0 180.0 Size 100.0 15.0 store_to Box_WingSpeed
1@ += sizeof_textBox
return

:ExitEditValuesMode
gosub @ResetBirdPosition
Status = STATUS_EDIT_BIRD_TYPE_MODE_IDLE
gosub @DestroyPanel
gosub @CreateEditPanel
return

:DiscardBirdValues
0AC6: 1@ = label @_BirdType offset
0AA5: call {memmove} 0x822A20 num_params 3 pop 3 _len 77 _src 1@ _dest pBirdType
return


:DrawEditValueBoxes
0@s = t_SpawnTime
0A8E: 2@ = pBirdType + 25
0A8E: 3@ = pBirdType + 29
0A8D: 2@ = read_memory 2@ size 4 virtual_protect 0
0A8D: 3@ = read_memory 3@ size 4 virtual_protect 0
gosub @SetupTextDraw_TextBoxName
0AB1: call_scm_func @textBox__DrawTextAboveMe 3 _self Box_MinSpawnTime 0@ 1@
gosub @SetupTextDraw_TextBoxValue
0AB1: call_scm_func @textBox__Draw_i 3 _self Box_MinSpawnTime 2@ true
gosub @SetupTextDraw_TextBoxValue
0AB1: call_scm_func @textBox__Draw_i 3 _self Box_MaxSpawnTime 3@ true

0@s = t_BirdsInFlock
0A8E: 2@ = pBirdType + 33
0A8E: 3@ = pBirdType + 37
0A8D: 2@ = read_memory 2@ size 4 virtual_protect 0
0A8D: 3@ = read_memory 3@ size 4 virtual_protect 0
gosub @SetupTextDraw_TextBoxName
0AB1: call_scm_func @textBox__DrawTextAboveMe 3 _self Box_MinBirdsInFlock 0@ 1@
gosub @SetupTextDraw_TextBoxValue
0AB1: call_scm_func @textBox__Draw_i 3 _self Box_MinBirdsInFlock 2@ true
gosub @SetupTextDraw_TextBoxValue
0AB1: call_scm_func @textBox__Draw_i 3 _self Box_MaxBirdsInFlock 3@ true


0@s = t_BirdHeight
0A8E: 2@ = pBirdType + 41
0A8E: 3@ = pBirdType + 45
0A8D: 2@ = read_memory 2@ size 4 virtual_protect 0
0A8D: 3@ = read_memory 3@ size 4 virtual_protect 0
gosub @SetupTextDraw_TextBoxName
0AB1: call_scm_func @textBox__DrawTextAboveMe 3 _self Box_MinBirdHeight 0@ 1@
gosub @SetupTextDraw_TextBoxValue
0AB1: call_scm_func @textBox__Draw_f 4 _self Box_MinBirdHeight 2@ 4 true
gosub @SetupTextDraw_TextBoxValue
0AB1: call_scm_func @textBox__Draw_f 4 _self Box_MaxBirdHeight 3@ 4 true

0@s = t_BirdSize
0A8E: 2@ = pBirdType + 49
0A8E: 3@ = pBirdType + 53
0A8D: 2@ = read_memory 2@ size 4 virtual_protect 0
0A8D: 3@ = read_memory 3@ size 4 virtual_protect 0
gosub @SetupTextDraw_TextBoxName
0AB1: call_scm_func @textBox__DrawTextAboveMe 3 _self Box_MinBirdSize 0@ 1@
gosub @SetupTextDraw_TextBoxValue
0AB1: call_scm_func @textBox__Draw_f 4 _self Box_MinBirdSize 2@ 4 true
gosub @SetupTextDraw_TextBoxValue
0AB1: call_scm_func @textBox__Draw_f 4 _self Box_MaxBirdSize 3@ 4 true


0@s = t_BirdDistance
0A8E: 2@ = pBirdType + 57
0A8D: 2@ = read_memory 2@ size 4 virtual_protect 0
gosub @SetupTextDraw_TextBoxName
0AB1: call_scm_func @textBox__DrawTextAboveMe 3 _self Box_BirdDistance 0@ 1@
gosub @SetupTextDraw_TextBoxValue
0AB1: call_scm_func @textBox__Draw_f 4 _self Box_BirdDistance 2@ 4 true


0@s = t_BirdSpeed
0A8E: 2@ = pBirdType + 61
0A8D: 2@ = read_memory 2@ size 4 virtual_protect 0
gosub @SetupTextDraw_TextBoxName
0AB1: call_scm_func @textBox__DrawTextAboveMe 3 _self Box_BirdSpeed 0@ 1@
gosub @SetupTextDraw_TextBoxValue
0AB1: call_scm_func @textBox__Draw_f 4 _self Box_BirdSpeed 2@ 4 true


0@s = t_WingSpeed
0A8E: 2@ = pBirdType + 65
0A8D: 2@ = read_memory 2@ size 4 virtual_protect 0
gosub @SetupTextDraw_TextBoxName
0AB1: call_scm_func @textBox__DrawTextAboveMe 3 _self Box_WingSpeed 0@ 1@
gosub @SetupTextDraw_TextBoxValue
0AB1: call_scm_func @textBox__Draw_i 3 _self Box_WingSpeed 2@ true

return

:ProcessEditValuesBoxes
if and
    0AB0:   key_pressed 0x9  // TAB
    timerb >= 500
then
    timerb = 0
    if bTestingBird == false
    then
        jump @TestBird           
    else
        jump @ResetBirdPosition 
    end    
end

if bTestingBird == true
then
    0085: 0@ = pCBird
    0A8D: 1@ = read_memory 0@ size 4 virtual_protect 0
    0@ += 0x4
    0A8D: 2@ = read_memory 0@ size 4 virtual_protect 0
    0509: 1@ = distance_between_XY 1@ 2@ and_XY XEditBirdPos YEditBirdPos
    0085: 0@ = pBirdType
    0@ += 57
    0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0 
    if 0035: 1@ >= 0@
    then
        jump @ResetBirdPosition
    end
end



if
0AB1: call_scm_func @Mouse_IsPressing_LMB 0
0AA1: return_if_false

for 0@ = 0 to 10
    0085: 1@ = Box_Array(0@,1i)
    if 0AB1: call_scm_func @textBox__SpinnerClicked 4 1@ textBox__SIDE_TOP MouseX MouseY
    then
        0@ = PANEL_FLAG_PRESSED_SPINNER_UP
        jump PanelSelectionHandler 
    end
    if 0AB1: call_scm_func @textBox__SpinnerClicked 4 1@ textBox__SIDE_BOTTOM MouseX MouseY
    then
        0@ = PANEL_FLAG_PRESSED_SPINNER_DOWN
        jump PanelSelectionHandler 
    end
end
return


{------------------------------ OTHERS -------------------------}
:GetBirdTypePtr
0085: 0@ = pMethodTable
0@ += 80 // [20]
0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0
0AA7: call_function 0@ num_params 1 pop 1  Index result_to pBirdType
return

:ReloadBird
0085: 0@ = pMethodTable
0@ += 104 // [26]
0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0
0AA5: call 0@ num_params 1 pop 1 pCBird
return


:TestBird
0085: 0@ = pMethodTable
0@ += 116 // [29]
0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0
0AA5: call 0@ num_params 3 pop 3 randSpeed -1.0 pCBird

0085: 0@ = pCBird
0@ += 0x49  // Moveable
0A8C: write_memory 0@ size 1 value true virtual_protect 0
bTestingBird = true
return

:ResetBirdPosition
0085: 0@ = pCBird
//0@ += 0x0   // RwV3D Position
0A8C: write_memory 0@ size 4 value XEditBirdPos virtual_protect 0
0@ += 0x4
0A8C: write_memory 0@ size 4 value YEditBirdPos virtual_protect 0
0@ += 0x4
0A8C: write_memory 0@ size 4 value ZEditBirdPos virtual_protect 0

for 1@ = 1 to 6
    0@ += 0x4
    0A8C: write_memory 0@ size 4 value 0.0 virtual_protect 0
end 


0085: 0@ = pCBird
0@ += 0x49  // Moveable
0A8C: write_memory 0@ size 1 value false virtual_protect 0
bTestingBird = false
return

{------------------------- BUFFERS --------------------------}

0000: PADDING
0000: PADDING
:TextboxBuffer
hex
    00000000 00000000 00000000 00000000 {01}     
    00000000 00000000 00000000 00000000
    00000000 00000000 00000000 00000000
    00000000 00000000 00000000 00000000
    00000000 00000000 00000000 00000000 {05}    
    00000000 00000000 00000000 00000000
    00000000 00000000 00000000 00000000
    00000000 00000000 00000000 00000000
    00000000 00000000 00000000 00000000
    00000000 00000000 00000000 00000000 {10}
    00000000 00000000 00000000 00000000 {11}    
end
0000: PADDING
0000: PADDING

:_Buffer
:_TextBuffer
:_BirdType
hex
    00 00 00 00 00 00 00 00 00 00   {10}
    00 00 00 00 00 00 00 00 00 00   {20}
    00 00 00 00 00 00 00 00 00 00   {30}
    00 00 00 00 00 00 00 00 00 00   {40}
    00 00 00 00 00 00 00 00 00 00   {50}
    00 00 00 00 00 00 00 00 00 00   {60}
    00 00 00 00 00 00 00 00 00 00   {70}
    00 00 00 00 00 00 00 00 00 00   {80}
    00 00 00 00 00 00 00 00 00 00   {90}
    00 00 00 00 00 00 00 00 00 00   {100}
end



{:_CBird
hex
	00000000 00000000 00000000 // RwV3D pos;
	00000000 00000000 00000000 // RwV3D field_C;
	00000000 00000000 00000000 // RwV3D Velocity;
    00000000                   // foat angle;
    00000000                   // unsigned int field_28; // Always 0
    00000000                   // unsigned int WingSpeed;
    00000000                   // float Size;
	00000000                   // float MaxBirdDistance;
    00000000                   // char field_38;  
    000000                     // unsinged char PolyColor1, PolyColor2, PolyColor3
    000000                     // unsinged char PolyColor4, PolyColor5, PolyColor6
	00                         // bool HasBirdHere;
	00                         // bool MustDoCurves;
    00 00 00                   // char Padding[3]
end}



{:_BirdType
hex
    00000000000000000000000000000000    // char			Identifier[16];
    00000000                            // int          ForceType;
    0000000000                          // bool         SpawningTown[5]
    00000000 00000000                   // MinMax<int>		SpawnTime;                       
    00000000 00000000                   // MinMax<int>		BirdsInFlock;
    00000000 00000000                   // MinMax<float>	Height;
    00000000 00000000                   // MinMax<float>	Size;
    00000000                            // float Distance
    00000000                            // float Speed
    00000000                            // int WingSpeedDiv
    00000000                            // unsigned int Flags
    00000000                            // RwTexture* m_Texture
end}


:LoadDefaultBirdTypeIntoBuffer
0AC6: 0@ = label @_Buffer offset

// Clear the _BirdType buffer
0A8C: write_memory 0@ size 77 value 0x0 virtual_protect 0

{Identifier[] = 0}
0@ += 16

{ForceType = -1}
0A8C: write_memory 0@ size 4 value -1 virtual_protect 0
0@ += 4

{ SpawningTown[] = '0' }
0A8C: write_memory 0@ size 5 value 0x30 virtual_protect 0
0@ += 5

{ SpawnTime.Min/Max = 0 }
0@ += 8

{ BirdsInFlock.Min/Max = 0 }
0@ += 8

{ Height.Min/Max = 0.0 }
0@ += 8

{ Size.Min/Max = 0.4/0.8 }
0A8C: write_memory 0@ size 4 value 0.4 virtual_protect 0
0@ += 4
0A8C: write_memory 0@ size 4 value 0.8 virtual_protect 0
0@ += 4

{ Distance = 0.0 }
0@ += 4

{ Speed = 0.0 }
0@ += 4

{ WingSpeed = 814 }
0A8C: write_memory 0@ size 4 value 814 virtual_protect 0
0@ += 4

{ Flags = '0010' }
0A8C: write_memory 0@ size 4 value 0x4 virtual_protect 0
0@ += 4

{ m_Texture = nullptr }
0A8C: write_memory 0@ size 4 value 0x0 virtual_protect 0
0@ += 4
return
